home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / owldlgs.zip / DLGSYSMD.CPP < prev    next >
C/C++ Source or Header  |  1993-04-08  |  3KB  |  63 lines

  1. /**********************************************************************/
  2. /*                  Dlgsysmd.cpp by Bob Bourbonnais                   */
  3. /*              released to the public domain 12/16/91                */
  4. /*              This program demonstrates a dialog box                */
  5. /*             with a menu and two buttons that can call              */
  6. /*      a system modal dialog box from either the menu or a button.   */
  7. /*      A system modal dialog box will not let you do anything in     */
  8. /*           any windows program until you have delt with it.         */
  9. /**********************************************************************/
  10. #include <owl.h>
  11. #include <dialog.h>
  12. #include "dlgsysmd.h"
  13.  
  14. class TDialog4Dialog : public TDialog    // Dialog class to add
  15.   {                     // processing for menu and
  16.   public:                 // button selections
  17.     TDialog4Dialog(LPSTR lpName)         // constructor calls
  18.       :TDialog(NULL,lpName) {};         // base class constructor
  19.     virtual void HandleMenuItem(RTMessage Msg)      // menu handler
  20.       = [CM_FIRST + IDM_MODAL_DIALOG];
  21.     virtual void HandleButtonMessage(RTMessage Msg) // button handler
  22.       = [ID_FIRST + IDB_MODAL_DIALOG];   // close button handled by
  23.   };                                     // base class button handler
  24. void TDialog4Dialog:: HandleMenuItem(RTMessage)
  25.   {
  26.   GetApplication()->ExecDialog(new TDialog(this,"Modal_Dialog_Box"));
  27.   }               //ExecDialog activates a modal dialog box
  28. void TDialog4Dialog:: HandleButtonMessage(RTMessage)
  29.   {
  30.   GetApplication()->ExecDialog(new TDialog(this,"Modal_Dialog_Box"));
  31.   }
  32.  
  33. class TDialog4App : public TApplication  // Application Class to contain
  34.   {                                      // the application
  35.   public:
  36.     TDialog4App(LPSTR lpName, HANDLE hInstance,  // constructor calls the
  37.         HANDLE hPrevInstance,            // base class constructor
  38.         LPSTR lpCmdLine, int nCmdShow)
  39.         :TApplication(lpName, hInstance,
  40.                   hPrevInstance,
  41.                   lpCmdLine, nCmdShow) {};
  42.  
  43.     virtual void InitMainWindow(); // overrides base class InitMainWindow
  44.   };
  45.  
  46. void TDialog4App::InitMainWindow() // to initialize a dialog box
  47.   {                                // as the main window
  48.   MainWindow = new TDialog4Dialog("Main_Window_Dialog");
  49.   }                                // using message processing provided
  50.                    // by derived class
  51.  
  52. int PASCAL WinMain(HANDLE hInstance,              // main entry point from
  53.            HANDLE hPrevInstance,          // windows to this program
  54.            LPSTR lpCmdLine , int nCmdShow)
  55.   {
  56.   TDialog4App Dialog4("Dialog Tester",hInstance,  // create instance of
  57.                hPrevInstance,             // the dialog application
  58.                lpCmdLine,nCmdShow);
  59.   Dialog4.Run();                                  // run it
  60.   return (Dialog4.Status);                        // exit
  61.   }
  62. /**********************************************************************/
  63.